/*
 *  dna_kernel.h -- provide dna-system syscall kernel side hook functions (user -> kernel).
 *
 *  ORIGINAL AUTHOR: Xu Chun (chun.xu@broadlink.com.cn)
 *
 *  Copyright (c) 2016 Broadlink Corporation
 */

#ifndef __DNA_KERNEL_H
#define __DNA_KERNEL_H

extern long (* kernel_syscall)(int number, ...);
extern int (* kernel_printf)(const char * format, ...);
extern int (* kernel_snprintf)(char * buffer, size_t size, const char * format, ...);
extern int (* kernel_sprintf)(char * buffer, const char * format, ...);
/*
*  It used for user layer to achieve similar to the printf interface.
*/
extern int (* kernel_vsnprintf)(char * buffer, size_t size, const char * format, va_list ap);
extern int (* kernel_sscanf)(const char * buffer, const char * format, ...);

#define dna_syscall(num, ...)               kernel_syscall(num, ##__VA_ARGS__)
#define dna_printf(fmt, ...)                kernel_printf(fmt, ##__VA_ARGS__)
#define dna_snprintf(buf, size, fmt, ...)   kernel_snprintf(buf, size, fmt, ##__VA_ARGS__)
#define dna_sprintf(buf, fmt, ...)          kernel_sprintf(buf, fmt, ##__VA_ARGS__)
#define dna_vsnprintf                       kernel_vsnprintf
#define dna_sscanf(buf, fmt, ...)           kernel_sscanf(buf, fmt, ##__VA_ARGS__)

#endif

